#coding=utf-8
from django.forms import Widget, Select
from django.utils.safestring import mark_safe

__author__ = 'czq'
class ShowWidget(Widget):
    def __init__(self,html, attrs=None):
        super(ShowWidget,self).__init__(attrs)
        self.html=html
    def render(self, name, value, attrs=None):
        return mark_safe(self.html)


class SelectBootstrap(Select):
    def __init__(self, attrs=None, choices=()):
        if attrs==None:
            attrs={'class':'form-control'}#['class']='form-control'
        else:
            attrs['class']='form-control'
        super(SelectBootstrap,self).__init__(attrs, choices)
    #def render(self, name, value, attrs=None, choices=()):
    #    pass
    #def build_attrs(self, extra_attrs=None, **kwargs):
    #    dict=super(SelectBootstrap,self).build_attrs(extra_attrs,**kwargs)
    #    dict['class']='form-control'
    #    return dict